package com.fastjars.business.spring.fastjson.filter;

import com.alibaba.fastjson.serializer.NameFilter;

/**
 * AbsName
 * 仅支持单个属性名称变更
 * @author Brant Liu <br>
 * 邮箱：lbf1988@qq.com <br>
 * 日期：2018/5/4
 * @version 1.0.0
 */
public abstract class AbsName extends AbsBase implements NameFilter {
    public abstract String setFieldName();

    public abstract String setNewFieldName(String name);

    @Override
    public String process(Object object, String name, Object value) {
        if(checkObject(object)) {
            if (name.equals(setFieldName())) {
                return setNewFieldName(name);
            }
        }
        return name;
    }
}
